package com.chenbei.system.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Schema(description = "操作日志实体类")
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_operation_log")
public class SysOperationLog {

    @Schema(description = "主键ID")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "模块名称")
    @TableField("module_name")
    private String moduleName;

    @Schema(description = "操作事件")
    @TableField("event_name")
    private String eventName;

    @Schema(description = "管理员ID")
    @TableField("uid")
    private Long userId;

    @Schema(description = "用户名")
    @TableField("username")
    private String username;

    @Schema(description = "IP地址")
    @TableField("ip")
    private String ip;

    @Schema(description = "区域")
    @TableField("region")
    private String region;

    @Schema(description = "耗时")
    @TableField("cost_time")
    private Long costTime;

    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}
